//
// Created by zhou on 2021/10/20.
//
#include <iostream>
#include "vector"
#include "string"
#include <map>
using namespace std;
class Solution {
public:
    bool isIsomorphic(string s, string t) {
        map<char,char> x;
        int size=s.length();
        if(s.length()!=t.length())return false;
        for(int i=0;i<size;i++){
            auto it=x.find(s[i]);
            if(it!=x.end()){
                if(t[i]!=it->second)return false;
            }
            else{
                for(auto iter=x.begin();iter!=x.end();iter++){
                    if(iter->second==t[i])return false;
                }
                x.insert(make_pair(s[i],t[i]));
            }
        }
        return true;
    }
};
int main(){
    string s="abccdad";
    string t="bcddebe";
    Solution solution;
    cout<<solution.isIsomorphic(s,t);
}

